<script>
 $(document).ready(function ()
    {
        $('#data').dataTable( {
            "sPaginationType": "full_numbers",
            "bLengthChange": false,
            "bInfo": false,
            "bProcessing": true
        });
    });
</script>
<fieldset>
	<?php echo $this->Form->create('Order'); ?>
	<div class="orders index">
		<h2><?php echo __('Create Orders'); ?> from <?php echo $suppliers['Suppliers']['supplierName']; ?></h2>
		<table id="data" class="table" cellpadding="0" cellspacing="0">
		<thead>
			<tr>
				<th>Brand</th>
				<th>Range</th>
				<th>Category</th>
				<th>Description</th>
				<th>Size</th>
				<th>On Hand Level</th>
				<th>Min Level</th>
				<th>Max Level</th>
				<th>Order Quantity</th>
			</tr>
			</thead>
			<tbody>
			<?php $a = 0;?>
			<?php foreach ($products as $product => $i): ?>
				<tr>
					<?php echo $this->Form->hidden($a, array('value' => $i['Product']['id'])); ?>
					<td><?php 	echo $i['Brands']['name'];?></td>
					<td><?php 	echo $i['Ranges']['name'];?></td>
					<td><?php 	echo $i['Categories']['name'];?></td>
					<td><?php 	echo $i['Product']['description'];?></td>
					<td><?php 	echo $i['Product']['size'];?></td>
					<td><?php 	echo $i['Product']['onhand_level'];?> </td>
					<td><?php 	echo $i['Product']['min_level'];?> </td>
					<td><?php 	echo $i['Product']['max_level'];?> </td>
					<td><?php echo $this->Form->input('Order Quantity.'.$a, array('value' => round($i['Product']['max_level'] - $i['Product']['onhand_level']), 'label' => '', 'type' => 'number', 'step' => 'any'));?></td>
				</tr>
				<?php $a++;?>
			<?php endforeach; ?>
			</tbody>
		</table>
	</div>
	<div class="newsubmit">
	<?php echo $this->Form->submit(__('Create Order', true), array('formnovalidate' => true, 'div' => false, 'class' => 'btn btn-success')); ?>
	<ul><li><?php echo $this->Html->link(__('Back'), array('action' => 'choosesupplier')); ?></li></ul></div>
</fieldset>